package com.zxy.supplier_system.server.controller

import com.zxy.supplier_system.server.service.AdministrativeRegionService
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

@RestController
@RequestMapping("administrativeRegions")
class AdministrativeRegionController(
    private val administrativeRegionService: AdministrativeRegionService,
) {

    @GetMapping("tree")
    fun getTree():List<AdministrativeRegionTreeResponse>{
        return administrativeRegionService.getFullRegionTree()
    }

    data class AdministrativeRegionTreeResponse(
        val code:String,
        val name:String,
        var children:List<AdministrativeRegionTreeResponse>,
    )

}

